﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProxyCase.ascx.cs" Inherits="WebService_Components_ProxyCase" %>
    <div id="dv-proxy-caches-<%=MethodName %>">
<%if(ProxyCases!=null && ProxyCases.Count>0){ %>
<div class="box-option" style="font-weight:bold;">Proxy case  for <%=MethodName %> (<%=ProxyCases.Count %>)</div>
<div class="box" style="margin-bottom:5px;">
    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="line-height: 1.5em;">
         <tr class="header-2"><td>Request</td><td class="border-l">Response</td></tr>
    <asp:Repeater ID="rptProxyCases" runat="server">
        <ItemTemplate>
            <%#Container.ItemIndex>0?"<tr><td colspan='2' style='height:5px;background-color:#fff;' class='line-sub'></td></tr>":"" %>
            <tr>
                <td colspan="2" class="line-sub"></td>
            </tr>
            <tr class="header-2"><td><%#Container.DataItem %></td>
                <td style="text-align:right;">
                <a class="a-btn" href="javascript:;;" onclick="SaveProxyCache('DEL','<%=MethodName %>','<%#Container.DataItem %>',true);">Delete This Case</a>
                </td></tr>
            <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
            <tr id="tr-proxy-<%=MethodName %>-<%#Container.DataItem %>">
                <td style="width:50%;background-color:#fff;">
                    <form id="form-proxy-request-<%=MethodName %>-<%#Container.DataItem %>" method="post" target="_blank" action="../Viewer.aspx">
                        <input name="type-proxy-request-<%=MethodName %>-<%#Container.DataItem %>" id="type-proxy-request-<%=MethodName %>-<%#Container.DataItem %>" type="hidden">
                    <textarea name="result-proxy-request-<%=MethodName %>-<%#Container.DataItem %>" id="proxy-request-<%=MethodName %>-<%#Container.DataItem %>" rows="5" cols="5" 
                        style="width: 100%;"><%#System.Web.HttpUtility.HtmlEncode(GetTogether.Studio.WebService.WebServiceProxyHelper.GetProxyCaseXml(CurrentSession.UserCode,Parameter.ProjectName,MethodName, (string)Container.DataItem,"Request.txt"))%></textarea>
                        </form>
                        </td>

                <td class="tdpbl">
                    <form id="form-proxy-response-<%=MethodName %>-<%#Container.DataItem %>" method="post" target="_blank" action="../Viewer.aspx">
                        <input name="type-proxy-response-<%=MethodName %>-<%#Container.DataItem %>" id="type-proxy-response-<%=MethodName %>-<%#Container.DataItem %>" type="hidden">
                    <textarea name="result-proxy-response-<%=MethodName %>-<%#Container.DataItem %>" id="proxy-response-<%=MethodName %>-<%#Container.DataItem %>" rows="5" cols="5" 
                        style="width: 100%;"><%#System.Web.HttpUtility.HtmlEncode(GetTogether.Studio.WebService.WebServiceProxyHelper.GetProxyCaseXml(CurrentSession.UserCode,Parameter.ProjectName,MethodName, (string)Container.DataItem,"Response.txt"))%></textarea>
                        </form>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
            <tr><td colspan="2">

                         <table width="100%" cellspacing="0" cellpadding="0" border="0" style="line-height: 1.5em;">
                             <tr><td style="width:10%;white-space:nowrap;">Proxy Name</td><td class="tdpbl">
                                 <textarea id="proxy-key-proxy-<%=MethodName %>-<%#Container.DataItem %>" rows="5" cols="5" 
                        style="width: 100%;height:17px;"><%#Container.DataItem %></textarea>
                                          </td></tr>
            <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
                             <tr><td style="width:10%;white-space:nowrap;">Regular Expression</td><td class="tdpbl">
                                 <textarea id="proxy-regular-<%=MethodName %>-<%#Container.DataItem %>" rows="5" cols="5" 
                        style="width: 100%;height:17px;"><%#GetRegularExpression((string)Container.DataItem)%></textarea>
                                          </td></tr>
                             </table>
                </td></tr>
                        <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
            <tr>
                <td style="text-align:right;">
                    <a href="javascript:;;" class="btn" onclick="FormatXml('proxy-request-<%=MethodName %>-<%#Container.DataItem %>');">Format</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','viewer','proxy-request-{0}-<%#Container.DataItem %>');">Viewer</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/xml','proxy-request-{0}-<%#Container.DataItem %>');">XML</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/plain','proxy-request-{0}-<%#Container.DataItem %>');">TEXT</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/html','proxy-request-{0}-<%#Container.DataItem %>');">HTML</a>
                    
                </td>
                <td style="text-align: right; padding: 2px;" class="border-l">
                    <a href="javascript:;;" class="btn" onclick="FormatXml('proxy-response-<%=MethodName %>-<%#Container.DataItem %>');">Format</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','viewer','proxy-response-{0}-<%#Container.DataItem %>');">Viewer</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/xml','proxy-response-{0}-<%#Container.DataItem %>');">XML</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/plain','proxy-response-{0}-<%#Container.DataItem %>');">TEXT</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/html','proxy-response-{0}-<%#Container.DataItem %>');">HTML</a>
                    <a href="javascript:;;" class="btn-special" onclick="SaveProxyCache('SAVE','<%=MethodName %>','<%#Container.DataItem%>',true);">Save</a></td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
        </table>
</div>
<%} %>
<div class="box-option">
    <div style="float:left;font-weight:bold;">Cache for <%=MethodName %> <%if(CacheKeys!=null&&CacheKeys.Count>0){ %>(<%=CacheKeys.Count %>)<%} %></div>
    <div style="float:right;">
    <a href="javascript:;;" class="a-btn" onclick="SaveProxyCache('DEL','<%=MethodName %>');">Clear All</a>
    <span class="mm-split">|</span>
    <a href="javascript:;;" class="a-btn" onclick="GetWebProxy('<%=MethodName %>');">
                            Refresh
                            </a></div>
    <div style="clear:both;"></div>
</div>
<div class="box">
 <%if(CacheKeys!=null && CacheKeys.Count>0){ %>
    <div>
<table width="100%" cellspacing="0" cellpadding="0" border="0" style="line-height: 1.5em;">


                            <tr class="header-2"><td>Request</td><td class="border-l">Response</td></tr>
    <asp:Repeater ID="rptResult" runat="server">
        <ItemTemplate>
            <%#Container.ItemIndex>0?"<tr><td colspan='2' style='height:5px;background-color:#fff;' class='line-sub'></td></tr>":"" %>
            <tr>
                <td colspan="2" class="line-sub"></td>
            </tr>
            <tr><td colspan="2" class="header-2" style="text-align:right;">
                <a class="a-btn" href="javascript:;;" onclick="SaveProxyCache('DEL','<%=MethodName %>','<%#Container.ItemIndex %>');">Delete This Cache</a>
                </td></tr>
            <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
            <tr id="tr-proxy-<%=MethodName %>-<%#Container.ItemIndex %>">
                <td style="width:50%;background-color:#fff;">
                    <textarea id="proxy-key-<%=MethodName %>-<%#Container.ItemIndex %>" rows="5" cols="5"
                         style="display:none;"><%#System.Web.HttpUtility.HtmlEncode((string)Container.DataItem)%></textarea>
                    <form id="form-proxy-request-<%=MethodName %>-<%#Container.ItemIndex %>" method="post" target="_blank" action="../Viewer.aspx">
                        <input name="type-proxy-request-<%=MethodName %>-<%#Container.ItemIndex %>" id="type-proxy-request-<%=MethodName %>-<%#Container.ItemIndex %>" type="hidden">
                    <textarea name="result-proxy-request-<%=MethodName %>-<%#Container.ItemIndex %>" id="proxy-request-<%=MethodName %>-<%#Container.ItemIndex %>" rows="5" cols="5" 
                        style="width: 100%;"><%#System.Web.HttpUtility.HtmlEncode(Container.DataItem.ToString().Replace(PrefixCacheKey,""))%></textarea>
                        </form>
                        </td>

                <td class="tdpbl">
                    <form id="form-proxy-response-<%=MethodName %>-<%#Container.ItemIndex %>" method="post" target="_blank" action="../Viewer.aspx">
                        <input name="type-proxy-response-<%=MethodName %>-<%#Container.ItemIndex %>" id="type-proxy-response-<%=MethodName %>-<%#Container.ItemIndex %>" type="hidden">
                    <textarea name="result-proxy-response-<%=MethodName %>-<%#Container.ItemIndex %>" id="proxy-response-<%=MethodName %>-<%#Container.ItemIndex %>" rows="5" cols="5" 
                        style="width: 100%;"><%#System.Web.HttpUtility.HtmlEncode((string)GetTogether.Web.CacheHelper.GetCache((string)Container.DataItem))%></textarea>
                        </form>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
            <tr><td colspan="2">

                         <table width="100%" cellspacing="0" cellpadding="0" border="0" style="line-height: 1.5em;">
                             <tr><td style="width:10%;white-space:nowrap;">Proxy Name</td><td class="tdpbl">
                                 <textarea id="proxy-key-proxy-<%=MethodName %>-<%#Container.ItemIndex %>" rows="5" cols="5" 
                        style="width: 100%;height:17px;">From Cache <%#(int)Container.ItemIndex+1 %></textarea>
                                          </td></tr>
            <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
                             <tr><td style="width:10%;white-space:nowrap;">Regular Expression</td><td class="tdpbl">
                                 <textarea id="proxy-regular-<%=MethodName %>-<%#Container.ItemIndex %>" rows="5" cols="5" 
                        style="width: 100%;height:17px;"></textarea>
                                          </td></tr>
                             </table>
                </td></tr>
            <tr>
                <td colspan="2" class="line-wsp"></td>
            </tr>
            <tr>
                <td style="text-align:right;">
                    <a href="javascript:;;" class="btn" onclick="FormatXml('proxy-request-<%=MethodName %>-<%#Container.ItemIndex %>');">Format</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','viewer','proxy-request-{0}-<%#Container.ItemIndex %>');">Viewer</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/xml','proxy-request-{0}-<%#Container.ItemIndex %>');">XML</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/plain','proxy-request-{0}-<%#Container.ItemIndex %>');">TEXT</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/html','proxy-request-{0}-<%#Container.ItemIndex %>');">HTML</a>
                    
                </td>
                <td style="text-align: right; padding: 2px;" class="border-l">
                    <a href="javascript:;;" class="btn" onclick="FormatXml('proxy-response-<%=MethodName %>-<%#Container.ItemIndex %>');">Format</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','viewer','proxy-response-{0}-<%#Container.ItemIndex %>');">Viewer</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/xml','proxy-response-{0}-<%#Container.ItemIndex %>');">XML</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/plain','proxy-response-{0}-<%#Container.ItemIndex %>');">TEXT</a>
                    <a href="javascript:;;" class="btn" onclick="ViewBy('<%=MethodName %>','text/html','proxy-response-{0}-<%#Container.ItemIndex %>');">HTML</a>
                    <a href="javascript:;;" class="btn-special" onclick="SaveProxyCache('SAVE','<%=MethodName %>','<%#Container.ItemIndex%>');">Save</a>
                    <a href="javascript:;;" class="btn-special" onclick="SaveProxyCache('SAVE','<%=MethodName %>','<%#Container.ItemIndex%>',true);">Save as proxy case</a>
                </td>
            </tr>

            
        </ItemTemplate>
    </asp:Repeater>
</table></div>
    <%}else{ %>
    <div style="padding:2px;">
    Cache not found
        </div>
    <%} %>
    </div>
        </div>